//账户明细
$(document).ready(function(){
    if(myinfo['userid'] && myinfo['random']){
        user_je();
        user_jf();
    }else{
        window.location.href='./login.html';
    }
    //金额
    function user_je(){
        var userid=myinfo['userid'];
        var random=myinfo['random'];
        var log_list=myconfig['api']+'getfinancelog&random='+random+'&type=1'+'&userid='+userid;
        $.get(log_list, {},function(data,status){
            if(data.lists.length==0 ||data.status==0){
                return false;
            }
            $.each(data.lists,function(idx,item){
                var now = new Date(parseInt(item.dateline) * 1000);
                var mons=now.getMonth()+1;
                htm='<dd>';
                htm+='<p>';
                if(item.num>0){
                    htm+='<i><b>时间</b>：'+mons+'-'+now.getDate()+'&nbsp;'+now.getHours()+':'+now.getMinutes()+'</i><em><b>收入:&nbsp;￥'+item.num+'</b></em>';
                }else{
                    htm+='<i><b>时间</b>：'+mons+'-'+now.getDate()+'&nbsp;'+now.getHours()+':'+now.getMinutes()+'</i><span>支出:&nbsp;￥'+item.num+'</span>';
                }
                htm+='</p>';
                htm+='<p><b>备注</b>：'+item.cause+'</p>';
                htm+='</dd>';
                $('#user_je').append(htm);
               $(".loading").hide()
            });
        },'json');
    }
    //积分
    function user_jf() {
        var userid=myinfo['userid'];
        var random=myinfo['random'];
        var log_list=myconfig['api']+'getfinancelog&random='+random+'&type=2'+'&userid='+userid;
        $.get(log_list, {},function(data,status){
            if(data.lists.length==0 ||data.status==0){
                return false;
            }
            $.each(data.lists,function(idx,item){
                var now = new Date(parseInt(item.dateline) * 1000);
                var mons=now.getMonth()+1;
                htm='<dd>';
                htm+='<p>';
                if(item.num>0){
                    htm+='<i><b>时间</b>：'+mons+'-'+now.getDate()+'&nbsp;'+now.getHours()+':'+now.getMinutes()+'</i><em><b>收入:&nbsp;￥'+item.num+'</b></em>';
                }else{
                    htm+='<i><b>时间</b>：'+mons+'-'+now.getDate()+'&nbsp;'+now.getHours()+':'+now.getMinutes()+'</i><span>支出:&nbsp;￥'+item.num+'</span>';
                }
                htm+='</p>';
                htm+='<p><b>备注</b>：'+item.cause+'</p>';
                htm+='</dd>';
                $('#user_jf').append(htm);
              
            });
        },'json');
    }
})